home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************/
- /* */
- /* Application: DrawLine */
- /* */
- /* Description: This application shows how to use the QuickDraw */
- /* pattern mode 'srcCopy' to invert the intersection */
- /* of the two green lines. */
- /* */
- /* Files: DrawLine.c */
- /* */
- /* Programmer: Greg Henderson */
- /* Organization: Apple Computer, Inc. */
- /* Department: Developer Technical Support, DTS */
- /* Language: CodeWarrior C/C++ */
- /* Date Created: 05-10-95 */
- /* */
- /****************************************************************************/
-
- #define KBaseResID 128
- #define kMoveToFront (WindowPtr)-1L
-
-
- /*********************/
- /* Functions */
- /*********************/
-
- void ToolBoxInit( void );
- void WindowInit( void );
- void DrawLine( void );
-
-
- /*************** main ***************/
-
- void main( void )
-
- {
- ToolBoxInit();
- WindowInit();
- DrawLine();
-
- while ( !Button() );
-
- }
-
- /*************** ToolBoxInit ***************/
-
- void ToolBoxInit( void )
-
- {
- InitGraf(&qd.thePort); /* init Quickdraw and global variables */
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs( nil );
- InitCursor();
-
- }
-
- /*************** WindowInit ***************/
-
- void WindowInit( void )
-
- {
- WindowPtr window;
-
- window = GetNewCWindow( KBaseResID, nil, kMoveToFront );
-
- if ( window == nil )
- {
- SysBeep ( 10 ); /* Couldn't load the WIND resource! */
- ExitToShell();
- }
-
- ShowWindow( window );
- SetPort( window );
- }
-
- /*************** Draw two Lines ***************/
-
- void DrawLine( )
- {
- Rect pictureRect;
- WindowPtr window;
-
- window = FrontWindow();
- pictureRect = window->portRect;
-
- PenNormal() ;
- PenSize(5,5);
-
- ForeColor( blackColor );
- PenMode(srcCopy);
- MoveTo( 50, 47 );
- LineTo( 300,231 );
-
- PenMode(srcXor);
- MoveTo( 400, 47 );
- LineTo( 200,231 );
-
-
- ForeColor( greenColor );
- PenMode(addMax);
- MoveTo( 50, 47 );
- LineTo(300,231);
-
- PenMode(addMax);
- MoveTo( 400, 47 );
- LineTo( 200,231 );
-
- }
-
-